-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow media type to be specified in release asset upload #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow media type to be specified in release asset upload #1102
Conversation
Update UploadOptions with a MediaType field. If the MediaType is provided to UploadReleaseAsset it will take precedence over the type retrieved from looking at the file extension. The complete order of precedence is: - MediaType in UploadOptions - media type from file extension - default media type, application/octet-stream Update unit tests to test the order of precedence, default value and that the Content-Type header is actually set in the upload request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, @aidenkeating! I like this a lot! Thank you for doing this.
LGTM.
Awaiting second LGTM before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else looks great, thanks for the PR.
For other Gophers watching, @aidenkeating has taken advantage of a cool feature of the JSON Marshaling machinery... this doc says:
Since we don't want Thank you, @gauntface! |
@gmlewis @gauntface Thanks for the review, really appreciated! I should have documented why |
No worries at all, @aidenkeating! This repo attracts a lot of new-to-Go developers since @willnorris laid an excellent foundation and maintained excellent consistency throughout the large API surface... so I try to remember this when anyone ventures into less-frequently-used language constructs... and yours is a great example. Thanks again for the PR! |
Update UploadOptions with a MediaType field. If the MediaType is
provided to UploadReleaseAsset it will take precedence over the type
retrieved from looking at the file extension. The complete order of
precedence is:
Update unit tests to test the order of precedence, default value and
that the Content-Type header is actually set in the upload request.